<?php

$c_fname=$client->id;

@unlink('tempx/'.$c_fname);

clearstatcache();
$c_str="";

while(1){
    
    $c_str=@file_get_contents('tempx/'.$c_fname);
    
    if(strlen($c_str)>0){
        
        $client->clientId=$c_str;
        $id_read=true;
        echo "\nID: $c_str \n";
        global $db;
        $query="DELETE FROM open_files WHERE opened_by=".$c_str;
        $db->query($query);
        break;
    }
    echo "\nLOOP\n";
    
    usleep(500000);
}